I don't think this function is used anymore - perhaps it can be deleted.