adding filewriter class and tests