Changed this script to hopefully work much smoother.