Refactored setNumber to address several issues

Decomposed the setNumber into easier to understand smaller functions.
Added logging.
Fixed issues with masking decimal numbers in IE and FireFox.