add validaton and refactor routes
fix merge conflicts