sorted out metric optimization