refactoring - use some more destructuring