Refactored - removed superfluous temp variable