re-orgnize the code structure