simpler check on values courtest of Robert Gonzalez