I don't like creating the overlay each time the main panel is created. It is not necessary. The first time the controller is created, buildUpMainHierarchy is calling replaceMainViewController, with overlay=nil, so, it is wrong, but the overlay is not being added twice. But if it wasn't nil, you wouldn't be adding it twice because it is the very same instance.

Solution?

- Let's remove the addSubview overlay from buildUpMainHierarchy, the overlay is always added in replaceMainViewController, makes sense.
- Let's create the overlay before calling the replace methods. That makes the use of overlay in replaceMainViewController not nil.

Does it sound good to you?