Refactored TranslateBinary function.