seperated out parsing to a new class, Topdocument. Added more tests.
seperated out parsing to a new class, Topdocument. Added more tests.