added horizontal switching