bug fixes in code
Merge pull request #1 from awatson1978/master

Bug fixes to code....