Fixing up the hat switch logic.