Finished homework 5.2