Script working

First working version of the script