Change code to be more clear and use Factory to create reader and writer