Minor improvements to the script

Hi,

I have made some minor changes to the script to improve its usability, feel free to merge.