Cognitive psychology is the school of psychology that examines internal mental processes such as problem solving, memory, and language. It had its foundations in the Gestalt psychology of Max Wertheimer, Wolfgang Köhler, and Kurt Koffka, and in the work of Jean Piaget, who provided a theory of stages/phases that describe children's cognitive development. Cognitive psychologists are interested in how people understand, diagnose, and solve problems, concerning themselves with the mental processes which mediate between stimulus and response. Cognitive theory contends that solutions to problems take the form of algorithms - rules that are not necessarily understood but promise a solution, or heuristics - rules that are understood but that do not always guarantee solutions. In other instances, solutions may be found through insight, a sudden awareness of relationships.