implemented homework #3