Completed functionality to write plain files for QLearning