Improve column definition sort + more unit tests