write function fun