re-org code