re-orgnize the code.