Merging changes suggested on pull request 2335 for ISPN-3877
More updates based on code review comments from Dan Brandie