Yes, 20-27 is used to calculate the pos mint of the balance to account for it in the balance. line 30-35 i added in there because i did  want to account for unconfirmed blocks which are already appearing in the getinfo balance some coins (bytecoin , tix and others) show the unconfirmed balance in getinfo which would meant too many funds would be sent out it seems as though ive not commited that part ill add it in now