solution for second part