refactor export controller to simplify