Minor variable name changes and some clean up of unused code