cleanup and some https stuff