Fix issue 77

This requires #83 to be completed before merge.