Added check for duplicate form submission