code for downloading a piece