rewriting upload to work asynchroniously