defined some functions