Improved vsprintf buffer allocation algorithm. Commented and cleaned
up code.