update to handle the empty case