Massive rewrite

Reduce the array inception by one level
Simply printing data
On small data sets the patch showed upto 75% drop in memorry usage although there is still scope for further improvment.