splitting more stuff out of main

if we're gonna ruin any chance of merging ever again we're gonna do it right