Refactor to use upload