Wrote the binary conversion algorithm