Working code, now reads train and test data from text files