Setting up watch function