Added iFrame support and refactored