added update and connect code