I can't seem to figure to figure out why after using promises it still isn't waiting and so $scope.return\_message is returning null. 

```
function getRandomCommit()
    {
        var d = $q.defer();
        $scope.repos = Repos.query({username: 'octocat'}).$promise.then(function ( value )
        {
            var ranNum = Math.floor((Math.random()*value.length) + 1);
            $scope.repo = Repo.get({username: 'octocat'}, {repo: value[ranNum].name}).$promise.then(function ( value2 )
            {
                $scope.commits = Commit.query({username: 'octocat'}, {repo: value2.name}).$promise.then(function ( value3 )
                {
                    var ranNum2 = Math.floor((Math.random()*value3.length));
                    d.resolve(value3[ranNum2].commit.message);
                    return d.promise;
                });
            });
        });
    };
    $scope.return_message = getRandomCommit();`

```