Refactor into transformWrite and transformRead

corrected the missing `name`
@aldeed Ready for test