adds a second way to solve todo6