Minor fixes to Python code based on responses to first pull request.