changes to solve my problem. Refactor and make a pull request