sorting friends and reflecting the state in the URL