added filter functionality - empty branches are not cleaned up