Misc refactoring

var renaming etc
Mis refactoring.  clean up etc