Rewritten code