adds john's code from datasnapshots.nemac.org