Fix HTTPS bug and clean up tree