CR feedback: clean up convert boolean expressions and add tests