added binary output function with a minimal test