Fixed bug in task #3
Fixed bug in task #3, added comments