added writer test
refactor
refactor