Splits this into several files
Removes fprintf(stderr, ...) everywhere