code re-structure