refactored app handlers