Further cleanup and restructure