Solution for issues #1, #6, and #7