Generalizations and fixups for scripts.