A large refactoring to support generalized expressions & fix a host of other issues.

fixes #131, fixes #122, fixes #116, fixes #105, fixes #103, fixes #89, fixes #52