Made fixes to significantly improve speed and memory performance of data logging. Should be able to record much longer trials now.