A Theory of the Serial Position Effect