No need to clutter code with a lot of repeated calls to calcIndex.  Made a cell variable to keep track of the current cell we're looking at - since we call it so often.  It might be worth it to make 'up', 'down', 'left','right' as well, if they are used so prolifically