adding the final version of the second problem