Cleaned up application object handling a little.