Corrected validateNumber function.

Also added some support for potential future feature (including command line arguments in context).