ID#201: refactoring to avoid duplicate code. Potentially fixing this issue.
Merge remote-tracking branch 'origin/master'