Refactor some exporting functions