Code cleanup and fixes for manage/ subdomain