solving assignment 2