Homework3 with comments