Fix internals of script. Now works!