Correct stage1 code