Refactored using non-standard (but widely) available itoa()