added working bezier function