refactoring
only append necessary rows
some comment