Some initial refactor to use save functionality from outside this project