added fixes for Issue #9 & Issue #10
cleaned up a bit.