doing function part