You could move the processing into the if/else conditions