Import of keepstate script.