Refactor of worker compiler

Just because we want people to understand what we do here.
(Squash merge please =)