dropunusedlevels function

Drop unused levels