write code for functions