feat(minErr): Remove duplicated code