Removed anonymous functions around angular stuff and stopped using temporary variables.