Helpful functionality for sorting and comparing