refactor server into a module
refactor server
fix destructor
fix stuff