First mostly working sync hoisting pass.