Homework 5.4 done and tested