Add document manager, and tidy up document notification