distributed logic from before to routes