cleaned up the Submit Function