Pulled out Sym substitution code into Sym.scala
Added new stuff.