Added ability to specify number of pins