switch instead of 2nd call of count() in elseif