Make metric's code more compact