made some changes to the export function