Using the $app instance for the client, removing globals