Successfully switch between layouts

Not the perfect version but works now.