wrote a bunch of switch stuff