Preparing for source split

Planning on continuing in my quest to clean up this massive piece of
shit. Hopefully this is a step in the right direction.

Beginning to isolate all functions as no longer relying quite as heavily
on other functions, allowing me to split the source code into multiple
files.