texture atlas and refactoring