refactor export image and remove unused stuff