adjusted scripts to make it more modular