simplify conditional and add comment