Many tweaks for server mode