sorting links properly