put format_binary code into the actual format function