Converting background functionality to use angular