Added conditional branching for id search, 404 if ID not found