Pasted code from angular