add basic layout switching function