Server code

Added the code from the Server