started work on refactoring the TCP server into a package that is more idiomatically organised