wrote some functions