Sort table rows instead of nodes array

Fix for issue #1