need to handle degeneracies