add reference write tests passing