Added comments. Removed unneccessary code