MOdified code for getUserData.