finished double search and added unit tests