add logic of functions