Rewrote parts in the script