refactored the shit out of hamming