added a switch in api