started my solution to lesson6prob3..still some bugs to iron out