Started implementing code generator. Offsets are probably broken