Hamming exercise - third refactor