Altered code to fit comments from last pull request.