Add handleSubmit function