Feature memcheck

There might be a few stupid changes coming from rebasing (branch was started a few commits ago).
A few stupid changes are included trying to get rid of some memory leaks (but it did not work out well).
The server has been split into two.
Logging as been rewritten.