moving the upload functionality to a separate class