changed line of code to appropriate place