Better indents
Solved binding of incorrect data to df;
Changed calculation to gradient rather than mean.
Changed low value to 15;
Added comment on necessary condition.
Added possibility of changing low value;
Fixed low value check code;
current problem with dir=1, where there appears to be a missing value
Change to put increase in i in-line with gradient check