merge in changes from @wardpenney