made some formatting changes so VIM would stop complaining. I also replaced a numeric regex test with is_numeric.