More refactoring on onix upload. test works ok locally