Improved context writer tests.
Improvements to context writer, file system code.