Made the script less stupid.