refactor echo server