Untangle if-statement