Changed R and search, added multiple tables