Refactor AppRouter code

Current code includes redundant object -> array transforming and looping. Refactored it to be simpler.