Added comments and deleted unnecessary code