Send the correct folder switching event, misc cleanup