Added more tests and fixed node removal

* Added unit tests for skip, break, replace and remove options.
* Fixed bugs in node removal accordingly.