switch function refined

Signed-off-by: abhinavvv <abhinavvv@gmail.com>