imple some fctions