core: Various cleanups