refactor rulebook and helper