Simplify, remove redundant parts of tests, remove redundant if, etc.