first working version of assignment 9