Updated code per remarks on the Pull Request