Some code copied from collective.cover