Add metric_fu and do some small refactoring