Changed sorting to be triggered on onclick due to performance reasons