rewrote with destructuring