clean up and integrate user profile query