Homework 2: fix second function