Rearranged the switch statement in director.js for leaner code.