Performance changes

btw, using matrices instead of cells is much faster and uses less memory..
Merge pull request #6 from rmanor/patch-3

Performance changes