Refactoring. Tiles generation.