major code refactoring, add "sync rows" function that is generalized for any table sync