revised using standard Compare