rewrote part of switchlink
implemented switch