Cleaned up code on RDSearch.
Added better functionality for testing and added some function comments.