rebase package, various tweaks and fixes