Un-nested the function so as to conform to the project's coding style.
Renamed _getParentStates -> _getAncestorStates. Added a brief comment to help understand the function quickly.
Removed unused code and refactored route service.