test puzzle and small refactor