database -> tilesource refactoring