Switched writing to take byte arrays