Unhardcoded writeCustomBinary.