Split app logic and request handlers