Some refactoring of SDApplication.