cleanup of if statements