Changed code according to the comments of the original pull request.