Added Log, handled infinite loop, multiple dimension arrays, out of memory errors