write some functions