Refactored search to allow for pagination of results