first run at solving assignment 2