Big refactoring, initial version of server added & working (no editing yet)