Refactor constructor