Refactoring with a constructor