some new code on document models