a small rewrite to fix encapsulated bodies (which were erroneously being line parsed)