Fix Makefile
Fix logging in mql
Refactor server shutdown
Fix indentation and cleanup