refactor pin init