Refactor out puzzle core