Modification according to Homework #3