Small optimizations and unfinished export function