more generic balance parsing mechanism