Make sure $app is passed around as an instance. Address later to see if it can be fixed better.