assiging rows to tables improved