Added server
Made the server work
Refactored the code