Added deleteRows method and tidied up some code.