TODO: implement binary reduction