Removed superfluous check for end of array