Refactoring Sample_app