Slightly slicker code for mode changes (no need to lookup the class)