Miscellaneous changes to code

Miscellaneous changes to code