docuemntation and refacotring