move business logic from handler to app