Added order by example, debug tidy up
Bugfixes

Committed fix for reported issues #9 + #21.
Also tidied up a lot of superfluous code and some ‘order by’ stuff that
was not needed.