finished the basic functions.