Added if statments to pins