Init: Move things into a function and be local

Create a single function to do the init. This allows us to have local
variables that won't get set in the shell when it's sourced