Made state an instance of reader and writer