Server stuff plus a few cleanup fixes