Adds export command and fixes issues in export command