refactored tiles solution