Added comments and deleted unnecessary functions