Works, if a bit of a memory hog.
Minor speed change.
Minor speed change.
minor modifications.
small change
fixed confused direction
Analyzing number of rows