Corrections and improvements to Cypher type system

This PR resolves numerous issues and concerns with the Cypher type system. It also adds a lot more testing around the various functions and applications, and makes significantly simplifies the use of types in order to improve understandability in the codebase.