Moved file operations to helper class.