Jm/csta

The giant merge of jm/csta into master.  This will probably require a bit of cleanup though most individual commits were already reviewed.
A lot of these things should probably be constants