Code factoring to create a server. Incomplete work.