improve switch formation to handle small range