Finished up the server code so it now works to specification.