Cleaning up, fixed some wrong substitutions