Nonce cleanup, logging, custom handler stuff, misc fixes