level generating refactoring