Updated metrics code