Fixed bug in process_switch and changed a couple variable names.