write two functions