Added partial solution for second problem