lots of changes/fixes