Refactor constructor for train class.