cleanup and restructoring