generics break, need to concrete Document type or refactor