another bunch of changes and fixes