Move actual data pin writing to centralized function