added preventDefault to prevent program from restarting on its own