Added comparison functions, started using ordered set instead of vector.