Various fixes, added pin output support