Clean up implementation of page writing.
Remove unused dependencies.