Updated algorithm; switched from periodic to reflective boundaries.