Fixes Issue #30 
Some code enhancements