modifications for django 1.6, serious overhaul