improvements

Thank you for making this script!

I created this fork for my own import into [UnquietCode/Flapi](https://github.com/UnquietCode/Flapi/issues). If you like the changes, please feel free to integrate them.

Cheers,
Ben