Refactored and improved collation APIs.