Reset & advanced options' code

also optimisations to the `https` code, and code reorganising (just a
bit)