Refactored the 3 and 4 of a kind code into a common method