Added upload logic