add an if to make it possible to turn off the optimized path for debugging