Added training and testing code