Added additional tests for empty/non-empty files.

I also refactored/improved the code a bit.
Added additional parser tests.