Removing redundant code from app delegate