Refactor and switch to ui-router.