written some functions