implementing some functions