 
     get_first_account: ->
         for k,v of @accounts
-            if v.is_my_account
-                return v
+            return v
         return null
 
     get_current_or_first_account: ->

    count_my_accounts: ->
        accounts = 0
        angular.forEach @accounts, (acct, name) ->
            if acct.is_my_account
                accounts += 1
        return accounts

    count_my_delegates: ->
        delegates = 0
        angular.forEach @accounts, (acct, name) ->
            if acct.is_my_account and acct.delegate_info != null
                delegates += 1
        return delegates

    # turn raw rpc return value into nice object
    populate_account: (val) ->
        acct = val
        acct.active_key = val.active_key_history[val.active_key_history.length - 1][1]
        acct.registered = val.registration_date and val.registration_date != "1970-01-01T00:00:00"
        #console.log "populate_account",acct.name

#            if @transactions["*"].length > 0
#                #@growl.notice "", "You just received a new transaction!"
#                angular.forEach @accounts, (account, name) =>
#                    @refresh_transactions(name)
#
#    # TODO: search for all deposit_op_type with asset_id 0 and sum them to get amount
#    # TODO: sort transactions, show the most recent ones on top
