large refactor and rework of the way $save and $upload work