Updates while working on script version
functions for script version
main program of script version