write in function