code refactoring to remove redundancy, fixed bugs in no results for list...

- refactored code to improve reuse
- fixed issue #30 
- fixed issue when there is no result in the list (after clearing the results)