Added hamming distance functionality and fixed other bugs