refactor constructor