TWIN: Reduce the amount of redundant code in the scripting system