Fix issue #6. Fix issue #7. Fix issue #8