Take current balance into account when calculating unallocated funds, closes #19