redesign scripts with conditional statements