Added more test cases, started preparations for backward search.