Some experimental code trying to get rid of legacy

Don't consider running it without backups.

NOT READY FOR MERGING