Refactor automatic upload to hub