automatically sort by first column
added flag to select sort order