updated scripts to be easier to read,maintain