Patch to solve Issue 7 and 9

Hi Alex,
I liked your plugin but I had some problem with the Issue 7 and 9 so I tried to resolve them.

I hope you'll like it.

Cheers,
Luca