added more refined iframe managment