Adding in server code, needs work. Bug fixeS