adapting script to access user profiles