cleanup and restructure