Polished and commented the script.