adding in export functionality, minor tweaks