updated database queries in user controller