Abstract lws calc. to clo_common, update sort implementations
to use it