Split main file into multiple, mostly self-contained files