refactored - performance gain