initialize state registers and add scripts