table view sorting and message building works