Added pin handling functions.