There's a lot of duplicated logic here.  Can we move this up outside of the switch and store the x,y values?