Added support for parsing Attachment record types.
Added a test case.
Made the code easier to read.