Refactoring Search class. More to be done in order to make this code better. Related to #22.