Refactors sample app delegate