Fixed issue #4, issue #6, and issue #7.