Fixed to use malloc
Includes pin declarations