refactored application_setup