Factor out same-user? function