lotto refactoring