Refactored code a bit so that getDataForPins was a static method