Tiles Prototype, code refactoring