Reorganize codes