restructure code.