Code cleaning up and commenting

cleaned up and commented for all the methods