code switch logic four parameters.