moved variable initialization above pin initializations