Added connect and disconnect functions