Enhanced to remove permission entries.