Code clean up and re-factoring.
Fixed a bug where the cells were being overwritten.