cleanup code for pull request #164