refactoring defineProperty