improved type checking, rewrote 'longDecToShortDec'