Splitting out the script code