Minor changes

Code clean-up and minor fixes