I was confused here by the comment and the variable names `has_read`. `readwrite` could also be ==`write`.
It'll do it's work in both cases, but I suggest to update the comment to reflect that.