refactored Reader class
refactored Writer class