Some more conversion to package-system style. Split base into several files.