Minor fixes to code in response to Nathan's comments