Move some logic out of Upload component