Refactored Console Application to accept application instance