script refactor: nonworking state