Simplify some logic