Refactoring of $state service to use a number of helpers instead.