Refactored to use transformer