Add TCP handling to main() function. I need to revisit this to handle threads / etc