Added tablesort support. still buggy