finish writting the basic functions of this program