Some improvements and fixing of bugs.
Fixed Issue #24.