Refactored app flow