Improved performance by changing from a switch to an array of action delegates