first solution to assignment 5