Refactor. Improved performance.