made slight changes accroding to comments on pull request