harmonization of the brute force solution with the elegant one