Basic substitution, bug fixes, and some minor features.