refactorig: split routing and processing