fixes and restructure