Process complex 'if' conditions, refactoring