Initial implementation of metric calculation