Removed the Duplicate declaration of var 'i';