Finished homework 1 solution