tweaking a bad if/elseif/else merge