Rewrite first bits to make it easier to read