Added training implementation etc.