Thank you very much, I'll try as soon as I have a chance and report back on the result!
For the boundaries in InputArray, another comment also mentioned the same thing so it looks like this is definitely something I need to fix. Any suggestion on how I can make sure that the array is terminated after each character/digit that is added to the array?