Convert plasmidScript code into a function to run with passed in parameters