cleaned up popup generation