Finish sort function within table