refactored to separate routes from main server file