implemented switch processing