Please document this functionality - it might be reusable in other contexts.