This is moved existing code, will do a clean up in a separate commit after the split (almost none of QUnit is confirming at the moment).