Fixed Issue #19 and some other minor changes