Remove unneeded code from tiles implementation
Fix bug and add tests for fix