Added most of the code until training. Commiting before training, just in case.