tileserver: refactoring