code check by Katie, added ex6 (julie)
Came up with alternative solution to sorting