add and write two functions