fix for PLFM-1662
fixed some tests and added more
fixed tests
addressed issues raised in the code review
Merge pull request #264 from john-hill/develop

Fix for PLFM-1662