Updated to use Object.defineProperty