Instupgrade4

Please review **carefully**.
It's a continuous rebase of a branch I'm working on and I'm not entirely sure what's in there... (1:15 AM here and quite sleepy)