implementing functionality specified on issue #9