Refactored Pin class