clean up and re-structure