modified as per suggestion in github discussion