Implemented train()