Refactored benchmark code