refactored routes so error messages display properly