refactored popup to use cleaner 'layout' structure rather than independent variables for horizontal and vertical.