finished the basic functions