Finished assignment 3 code