Refactoring router.go to handle errors. Improving code coverage.

Refactoring router.go to handle errors. Improving code coverage.
I will change return type for CreateFrontend