Added balance support to library and example