style changes and a few other small tweaks to cleanup the code