Refactor types

This PR is an initial change to fix the cq types subpackage. It also affects how parameters are encoded, fixing issues where cq types were encoded as strings instead of what they should be. Still, more work needs to be done--I'll open issues for known limitations.