Fixed bug causing bad output on 3+ digit numbers. 

Still untested for values that give really large numbers.