Error checking and sort/add/average practice