Fixes and restructure