formats code
Adds comment about bspgen
broken version; factors out code into files
Non-crashing version of last commit
Moves console stuff into separate file
Refactors more stuff into new file