Reapplying the merge from Issue #29 which has been (accidentally?) overwritten recently