Refactor free variables to reference parameters in existing model