Added CO function

The function that sorts all functions using cosine.