improved parameter validation, expanded test coverage

plus removed debugging remnants