working now for pid to get the records