refactor tiles controller