Adding and fixing pull request from a-kulbei since he had not fixed the isses noted by author.