Fixing issues raised in the comments on the PR