added export functionality. started command refactor for more modularity