implement deley function