refactored tiles module