add method to check code switch