refactoring and fixes to Tmx.Server