Rewrote Script Logic