Refactor to use isolate scope