Refactored for perf