According to Freud's psychoanalytic theory, which part of the personality operates on the reality principle and is concerned with mediating the demands of the id and superego?