Tweaked file contents error message formatting.
Refactored certain file methods to test the content type first.

Partial implementation of #3