made comments, cleaned code; made averages