Moved maxPins code to a method.