tweaked switch script