added DOM ready check