Various cleanups of the global object coming from !648 (closed) to be used as base for !1759.
/cc @jadahl