replace switch to script