Added delay parameter to work properly in Firefox