Some enhancements

I hope you don't mind that I changed your plugin like that but I have a client that would like to use this and needed these changes.

Cheers,
Dennis.