first version with abstract Pin class