Puzzle RC2
Some refactoring