implemented functions and commented them