re-order some code (master)