Cleanup and HTTPS support