Refactor type definition & Fix bugs in secondary type

Test after re-setup of CouchDB content and overwriting ActiveCMIS.
Otherwise it won't work.