Added solution 2 (part 1)