Refactoring, and added ability to specify search result size for scoped searches.