added helpers and refactored routing logic.
cleanup