updated script system, now working pretty well