Implement import/export functionality, more code consistency cleanup