finished code for uploader