Reformat and rewrite write_binary() part 2