working apply with new document model