implement document.cards interface, remove dead code and add visibility inline