Function added to submit button