Added keypath substitutions. Comments improved