New solution with tests