re-structure the script