Refactored Performance Code