Mostly working insert courses script