Added Arne's contributions that I seemed to have overwritten...
Updated to run on Django 1.5.
Fixed some mistakes introduced during cleanup