this code block should get a comment to clarify what is being checked here, because it's not immediately clear to me