Removing switching layout code