did a little work on checking parameters for validity