refactor genserver