Remove cumulative argument, untangle nested if-else