-fix slowdown caused by returning 0 from AddData
-add proper delay code