Output to textfile

All the code is there, should work, can't test it until Phil commits the
UI to call the method. I'll add that when he's committed