Change pin from int to size_t, reorder fields