Cleaned up the submission code a little