Adds logic to build where clause string, also cleans up search partial
updated with search 4-19 4:15