Added lines to read and write training data