refactor 'add row' operation