rewrite checkInsert using "... |" notation