improved export function