Switched from modal popup to popup panel. Some additional refactoring.