Setup support for various layouts
Refactored popover into single code base