Completed second exercise in assignment 1.