refactored m101p week 3 homeworks