Extract hunk building into own method
Extract a bunch of domain methods
Extract encoding handling into own class