added sorting to table