Big fixes and misc