Change uses of $this to app() calls