REL-1596: Fixed stupid bug.
REL-1596: Fixed bugs as found by Andy and modified unit tests to test new features.
REL-1596: Made code change as recommended by Shane.
Merge pull request #58 from sraaphorst/feature/REL-1596

REL-1596: Fixed bugs as per testing and modified test cases to test new features.