re-wrote newPin function