Don't allow options to be mutated inside util functions
Cleanup of socket code
Cleanup of init code