Added some enhancements

Hi wycks,
could you consider add these changes into your repo?
I added some small enhancements and also a couple of bug-fixings.