improvements as discussed in the pull request #1