Added tests, sorted out bug with search results ordering