Fixes and general improvements