improve export and file handler