Further splitting things out of main