modified to work with angular-ui-router v.2.0