More cleanup and restructuring