Moved file writing to superclass