a lot of fixes + structure changes