cleaning code and commenting it