document-type to trellocard
small fixes and optimisations