Creating generalized procedures by demonstration