bit of cleanup
more of the safer input checking...