modifies function for role check to be consistent and more accurate