an attempt at sorting contacts