Code for transferring data (not working yet)