refactoring to allow benchmarking via switch