Updated according to the new CSscript framework