Code I wrote as part of a summer research co-op.