the required functions

first version of the functions