add allinrow and simplify