This is a re-implementation of existing code. I don't yet know why the original authors chose this method.