refactored to render search partial rather than duplicate code