Procedural generation and refactoring