added functionality to challenge2 functions. not working yet.