Add better solution for the second homework