Moved File writing to a Writer Class