bin2gray works perfectly
gray2bin: removed unused variable (bev).