added dataset balancing functionality, need some fix