added average mistake calculation
improved spike detection
further tweaking
merged