improved scaffolding logic and implemented export