Constructing the functions