refactoring to Tmx.Server and unit tests