Fixing issue #5, issue #7