early draft of nif writing code