added note on possible simpler solution ;-)