fixed the script but it still needs smoothing