Added functionality described in issue #8 and the corresponding tests.
Merge pull request #9 from Zillolo/metric

Added functionality described in issue #8 and the corresponding tests.