Remove redundant logical tests to simplify code