Refactor work into document load.