Cleaned up submission code