added dumb analysis of next payment
Added some useful functions