Made the script more efficient.