Solved solution 2