edited to match browser compatibility