[#541] removed duplicated code