update working example binding function to scope