slightly improved submission logic