refactored with routes