another refactoring with constructors