adds solution to quetion 3