Improved code as it was mentioned in the pull request.