Added a separate thread for the server. No communication between the server thread and main thread yet.