Modify this script to make it modular