delete a row. also some refactoring of js