Updated pull request #1506 after feedback