Finished the export function.