Refactored controller code and router output parameters.
Cleanup.